<?php

namespace GamesBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @author  coffey  <coffey@nligo.com>
 * UserInvite
 *
 * 用户邀请关系表
 * @ORM\Table(name="user_invite")
 * @ORM\Entity(repositoryClass="GamesBundle\Repository\UserInviteRepository")
 * @ORM\HasLifecycleCallbacks()
 */
class UserInvite
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false,options={"comment":"邀请自增id"})
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;


    /**
     * @ORM\ManyToOne(targetEntity="User")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     */
    private $userId;

    /**
     * @ORM\ManyToOne(targetEntity="User")
     * @ORM\JoinColumn(name="inviter_id", referencedColumnName="id")
     */
    private $inviterId;

    /**
     * @var string
     *
     * @ORM\Column(name="inviter_code", type="string",length=100,options={"comment":"邀请码"})
     */
    private $inviteCode = '';

    /**
     * @var integer
     *
     * @ORM\Column(name="create_at", type="integer", nullable=false,options={"comment":"创建时间"})
     */
    private $createAt = '0';

    /**


    /**
     * @ORM\PrePersist
     */
    public function PrePersist(){
        $this->setCreateAt(time());
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set inviteCode
     *
     * @param string $inviteCode
     *
     * @return UserInvite
     */
    public function setInviteCode($inviteCode)
    {
        $this->inviteCode = $inviteCode;

        return $this;
    }

    /**
     * Get inviteCode
     *
     * @return string
     */
    public function getInviteCode()
    {
        return $this->inviteCode;
    }

    /**
     * Set createAt
     *
     * @param integer $createAt
     *
     * @return UserInvite
     */
    public function setCreateAt($createAt)
    {
        $this->createAt = $createAt;

        return $this;
    }

    /**
     * Get createAt
     *
     * @return integer
     */
    public function getCreateAt()
    {
        return $this->createAt;
    }

    /**
     * Set userId
     *
     * @param \GamesBundle\Entity\User $userId
     *
     * @return UserInvite
     */
    public function setUserId(\GamesBundle\Entity\User $userId = null)
    {
        $this->userId = $userId;

        return $this;
    }

    /**
     * Get userId
     *
     * @return \GamesBundle\Entity\User
     */
    public function getUserId()
    {
        return $this->userId;
    }

    /**
     * Set inviterId
     *
     * @param \GamesBundle\Entity\User $inviterId
     *
     * @return UserInvite
     */
    public function setInviterId(\GamesBundle\Entity\User $inviterId = null)
    {
        $this->inviterId = $inviterId;

        return $this;
    }

    /**
     * Get inviterId
     *
     * @return \GamesBundle\Entity\User
     */
    public function getInviterId()
    {
        return $this->inviterId;
    }
}
